<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.ncp.model.biz.comment.CommentCl"%>
<%@page import="com.ncp.model.entity.comment.ProductComment"%><%@page import="com.ncp.model.entity.product.CommentBean"%>


<%
int id=1;
int nowPage=1;
int showPages=5;
int size=2;
nowPage=Integer.parseInt((String)request.getAttribute("nowPage"));
CommentBean cb = (CommentBean)request.getAttribute("cb");
int PageCount=cb.getPagecount();
ArrayList<ProductComment> list=(ArrayList)request.getAttribute("list");
CommentCl cc=new CommentCl();
ProductComment pc=null;
%>
					<div class="evaluate">
					 <div class="evaluate">

						<%
						request.setAttribute("p",nowPage);
					for(int i=0;i<list.size();i++){
				    	
				    	 pc=list.get(i);
				    	 if(!pc.getComment().equals("")){%>
							<div class="hippo">
							<%
				    		 if(pc.getIsDisplayUserName()==1){
				    			 %>
				    			 <p class="til"><span class="person_name left">用户<font color="red"><%=cc.getUsername(pc.getUserID()) %></font>给出<%for(int j=0;j<5;j++){
				    				 if(j<pc.getScore()){
				        				 %>
				         	    		<img src="images/absulote/icon_star_2.gif">
				         	    		<%
				        			 }else{
				        				 %>
				          	    		<img src="images/absulote/icon_star_1.gif">
				          	    		<%
				        			 }
				    			 }%>的评分</span><span class="time right"><%=pc.getCommentTime() %></span></p><%
				    		 }else{
				    			 %>
				    			 <p class="til"><span class="person_name left">匿名用户给出<%for(int j=0;j<5;j++){
				    				 if(j<pc.getScore()){
				        				 %>
				         	    		<img src="images/absulote/icon_star_2.gif">
				         	    		<%
				        			 }else{
				        				 %>
				          	    		<img src="images/absulote/icon_star_1.gif">
				          	    		<%
				        			 }
				    		 }%>的评分</span><span class="time right"><%=pc.getCommentTime() %></span></p><%
				    		 }
				    	 %>
				    	 <div style="clear:both"></div>
				    	 <p class="cont"><%=pc.getComment() %></p>
				    
				    	 <%
				    	 %></div><%
				    	 }
				    	 
					}
				        		 %>
					</div>
					</div>
					
					
				
					
			<div id="page">
					<ul>
					
					<% 
					if(nowPage>1){
						%><li><a onclick="lastPage()" class="page">上一页</a></li><%
					}
					
					
					
						if(PageCount>=showPages){
							if(nowPage-size<=0){
								for(int i=1;i<=showPages;i++){
									%>
									
									<li><a onclick="p(<%=i %>)" class="num" ><%=i %></a></li>
									<%
								}
								%><li>...</li><%
							}else if(nowPage+size<PageCount){
								for(int i=nowPage-size;i<=nowPage+size;i++){
									%>
									
									<li><a onclick="p(<%=i %>)" class="num" ><%=i %></a></li>
									<%
								}
								%><li>...</li><%
							}else if(nowPage+size>=PageCount){
								for(int i=PageCount-showPages+1;i<=PageCount;i++){
									%>
									
									<li><a onclick="p(<%=i %>)" class="num" ><%=i %></a></li>
									<%
								}
							}
						}else if(PageCount<=showPages){
							for(int i=1;i<=PageCount;i++){
								%>
								<li><a onclick="p(<%=i %>)" class="num" ><%=i %></a></li>
								<%
							}
						}
						
						if(nowPage<PageCount){
							%>
							<li><a onclick="nextPage()" class="page" ">下一页</a></li>
							<%
						}
						%>
						<li>共<%= cb.getPagecount()%>页&emsp;</li>
							
							<li><input onclick="skip()" type="button" value="跳到"/></li>
							<li><input onchange="skip()" id="skip" type="text" name="page" style="width:30px; border:1px solid #CCC;" value="<%=nowPage %>"/></li>
							<li>页</li>
					</ul>
		</div>
 <body>